home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / dfpp01.zip / POPDOWN.H < prev    next >
C/C++ Source or Header  |  1992-11-21  |  2KB  |  67 lines

  1. // -------- popdown.h 
  2.  
  3. #ifndef POPDOWN_H
  4. #define POPDOWN_H
  5.  
  6. #include "desktop.h"
  7. #include "listbox.h"
  8.  
  9. const unsigned char LEDGE          = '\xc3';
  10. const unsigned char REDGE          = '\xb4';
  11. const unsigned char CASCADEPOINTER = '\x10';
  12.  
  13. inline unsigned char CheckMark()
  14. {
  15.     return desktop.screen().Height() == 25 ? 251 : 4;
  16. }
  17.  
  18. class MenuSelection;
  19. class MenuBar;
  20.  
  21. class PopDown : public ListBox    {
  22.     MenuSelection **selections;    // array of selections
  23.     Bool isopen;                // True = menu is open
  24.     Bool iscascaded;            // True = menu is cascaded
  25.     int menuwidth;                // width of menu
  26.     int menuheight;                // height of menu
  27.  
  28.     void BuildMenuLine(int sel);
  29.     void MenuDimensions();
  30.     void SetColors();
  31.     void DisplayMenuLine(int lno);
  32.     Bool ShortCutKey(int key);
  33. protected:
  34.     void ClearSelection();
  35. public:
  36.     PopDown(DFWindow *par, MenuSelection **Selections = NULL)
  37.                         : ListBox(5, 5, par)
  38.             { selections = Selections; OpenWindow(); }
  39.     virtual ~PopDown()
  40.         { if (windowstate != CLOSED) CloseWindow(); }
  41.     // -------- listbox API messages
  42.     void OpenWindow();
  43.     void CloseWindow();
  44.     void OpenMenu(int left, int top);
  45.     void CloseMenu(Bool SendESC);
  46.     void Show();
  47.     void Paint();
  48.     void Border();
  49.     void Keyboard(int key);
  50.     void ShiftChanged(int sk);
  51.     void ButtonReleased(int mx, int my);
  52.     void LeftButton(int mx, int my);
  53.     void DoubleClick(int mx, int my);
  54.     void Choose();
  55.     void SetSelection(int sel);
  56.     Bool isOpen() { return isopen; }
  57.     Bool &isCascaded() { return iscascaded; }
  58.     Bool AcceleratorKey(int key);
  59.     Bool ParentisMenu(DFWindow &wnd);
  60.     Bool ParentisMenu() { return ParentisMenu(*this); }
  61. };
  62.  
  63. #endif
  64.  
  65.  
  66.  
  67.